package com.yodawnla.fishing.hud;

 
import com.yodawnla.fishing.R;
import com.yodawnla.fishing.system.Fonts;
import com.yodawnla.fishing.system.Tex;
import com.yodawnla.lib.YoActivity;
import com.yodawnla.lib.util.widget.YoButton;
import com.yodawnla.lib.util.widget.YoText;


public class OkWindow extends Window
{
	public static OkWindow getInstance()
	{
		if (instance == null)
			instance = new OkWindow();
		return instance;
	}
	
	static OkWindow instance;
	
	YoText mOkBtnText;
	
	OkWindow()
	{
		super(HudValues.Name.OkWindow, HudValues.ZIndex.OkWindow);
		
		YoButton button = new YoButton(mHudMgr.getHud(), 137, 166, YoActivity.getBaseActivity().getTexture(Tex.Button2))
		{
			public void init()
			{
				mOkBtnText = new YoText(20, 20, Fonts.White20, YoActivity.getBaseActivity().getRString(R.string.Ok));
				mOkBtnText.setPosition((this.getWidth() - mOkBtnText.getWidth()) / 2, (this.getHeight() - mOkBtnText.getHeight()) / 2);
//				mOkBtnText.setColor(0, 0, 0);
				this.attachChild(mOkBtnText);
			}
			
			public void onClickedEvent()
			{
				if (mListener != null)
					mListener.onOkClicked();
				hide();
			}
		};
		mWindow.attachChild(button);
	}
	
	public void show(String text)
	{
		mOkBtnText.setText( YoActivity.getBaseActivity().getRString(R.string.Ok)); // Default
		super.show(text, null);
	}
	
	public void show(String text, String btnText)
	{
		mOkBtnText.setText(btnText);
		super.show(text, null);
	}
	
	public void show(String text, String btnText, IButtonClickListener listener)
	{
		mOkBtnText.setText(btnText);	 
		super.show(text, listener);
	}
	
	public void show(Param param)
	{
		mOkBtnText.setText(param.mOkBtnText);
		super.show(param);
	}
}
